package com.educate.ucenter.dao;

import com.educate.ucenter.dao.impl.FamilyMemberDaoImpl;
import com.educate.ucenter.model.bo.FamilyMemberBO;
import com.educate.ucenter.model.po.FamilyMember;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface FamilyMemberDao extends MongoRepository<FamilyMember, String> {

    /**
     * #{@link FamilyMemberDaoImpl#query(FamilyMemberBO, Pageable)}
     */
    Page<FamilyMember> query(FamilyMemberBO bo, Pageable pageable);

    List<FamilyMember> findByUserId(String userId);

    List<FamilyMember> findByFamilyId(String familyId);

    Optional<FamilyMember> findByFamilyIdAndUserId(String familyId, String userId);

    boolean existsByUserIdAndFamilyId(String userId, String familyId);
}
